Media streams delivered over a digital network, such as the Internet, are typically encoded and delivered as several segments. For instance, a Moving Picture Experts Group (MPEG) media stream is formed from several transport stream (TS) files with each TS file representing a different segment of the media stream. Each segment encodes a short duration of the overall media stream.
A client player sequentially requests the segments of a particular media stream from a server in order to locally render and playback that particular media stream. Instead of requesting all segments at one time, the client player requests a next segment based on its current playback position of the particular media stream. The client player typically requests some subset of next segments ahead of the current playback position to allow the server time to respond.
If the server is too slow to respond to the client requests, the client will experience buffering or an interruption in the stream playback. One manner with which to improve server response time is for the server to prefetch into memory (i.e., volatile random access memory or caching buffer) the expected next segments that will be requested by a client player in advance of the client player requesting those segments. Prefetching allows the server to immediately respond to the client player requests upon arrival without retrieving the segments from a different origin server or slower disk storage. In other words, the server is able to respond to a request for each prefetched segment without the delay associated with a round trip time to a different server or without the delay associated with a read operation to slower storage. The server typically does not prefetch all segments of a media stream because of the large size of the media stream and limited size of the memory, and also because doing so may be a wasted operation should the client player request a certain subsection of a particular media stream before terminating playback of the particular media stream or jumping to another media stream.
The server performs an internal request and response procedure in order to prefetch media stream segments. The internal procedure involves the server generating prefetch requests that specify the names of the segments to prefetch and sending the prefetch requests to an origin server or to an internal process. The ability of the server to prefetch segments is therefore dependent on the server's ability to accurately determine the names of the segments to be prefetched from a client request for a preceding segment.
In a simple scenario, segment names of a media stream follow a sequential naming convention. Thus, if the server receives a client request for segment “streamname_segment23.ts”, the server could generate prefetch requests for segments “streamname_segment24.ts”, “streamname_segment25.ts”, and “streamname_segment26.ts” as one example.
However, not all encoders encode media streams according to the same naming convention and media stream creators may specify their own custom naming convention for different streams. In other words, the segment name format and the iterator for the variable portion of the segment names may be different for different media streams.
Any server that is tasked with distributing multiple media streams therefore cannot use the same set of rules to generate the names for the segments to be prefetched. This is especially true in a content delivery network (CDN) where a distributed set of servers distribute several streams on behalf of many different media stream creators. The CDN is expected to not only deliver the streams without restriction to any naming convention, but to optimize the delivery through prefetching to improve the end user experience.
Accordingly, there is a need for a dynamically adaptable stream segment prefetcher. Specifically, there is a need for a prefetcher that dynamically adapts based on the variance in the naming convention of the media streams being prefetched. To that end, there is a need for the prefetcher to correctly generate prefetch requests based on different naming conventions used to specify segment names of different media streams. In other words, there is need to implement prefetching for streams where the segment name format differs and the iterator for the variable portion of the segment name is arbitrarily placed within the segment name format.